<%@ page import="cn.school.entity.Subject" %>
<%@ page import="cn.school.entity.Grade" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2022-02-18
  Time: 15:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改课程</title>
</head>
<body>
<h1>修改课程</h1>
<%
    List<Grade> grades = (List<Grade>) request.getAttribute("grades");
    Subject subject= (Subject) request.getAttribute("subject");

%>
<form>
    <p>
        <label></label><input type="number" name="Id" value="<%=subject.getId()%>"/>
    </p>
    <p>
        <label></label><input type="text" name="Subjectname" value="<%=subject.getSubjectname()%>"/>

    </p>
    <p>
        <label></label><input type="number" name="Classhour" value="<%=subject.getClasshour()%>"/>
    </p>
    <p>
        <label></label> <select name="gradeid" id="" value="<%=subject.getGradeId()%>">
        <%
        for (Grade grade: grades){

    %>
        <option value="<%=grade.getId()%>">

            <%
            if (grade.getId()==subject.getGradeId()){
                out.print("selected");
            }
            %>
            <%=grade.getGname()%>
        </option>
        <%
            }
        %>
    </select>

    </p>
    <p>

        <input type="submit" value="save">
    </p>


</form>
</body>
</html>
